<template>
  <view>
    <!-- 搜索 -->
    <UgoSearch></UgoSearch>
    <!-- tab栏 -->
    <u-tabs
      :list="list"
      :is-scroll="false"
      :current="current"
      @change="change"
      active-color="#eb4450"
      bar-width="150"
    ></u-tabs>
    <view v-if="current === 0">综合<iew>
    <view v-if="current === 1">销量<iew>
    <view v-if="current === 2">销量<iew>
  <iew>
</template>

<script>
// query
// cid
// pagenum
// pagesize
export default {
  data() {
    return {
      list: [
        {
          name: "综合",
        },
        {
          name: "销量",
        },
        {
          name: "价格",
        },
      ],
      current: 0,
      goods: [],
    };
  },
  onLoad(options) {
    console.log(options);
    this.params = {
      query: "",
      cid: options.cid,
      pagenum: 1,
      pagesize: 10,
    };
    this.getGoodsList();
  },
  methods: {
    change(index) {
      this.current = index;
    },
    // 获取商品详情列表
    async getGoodsList() {
      const result = await this.$u.get("/goodsarch", this.params);
      console.log(result);
      this.goods = result.message.goods;
    },
  },
};
</script>

<style>
</style>